package org.ushio.nchu_22201402.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.ushio.common_module.entity.Admin;
import org.ushio.nchu_22201402.entity.Package_Sale;
import org.ushio.nchu_22201402.mapper.Admin_LoginMapper;
import org.ushio.nchu_22201402.mapper.Package_SaleMapper;
import org.ushio.nchu_22201402.service.Admin_LoginService;
import org.ushio.nchu_22201402.service.Package_SaleService0;

import javax.annotation.Resource;
import java.util.List;

@Service
public class Admin_LoginServiceImpl extends ServiceImpl<Admin_LoginMapper, Admin> implements Admin_LoginService {

    @Resource
private Admin_LoginMapper admin_loginMapper;


    @Override
    public List<Admin> AllAdmin() {
        return admin_loginMapper.AllAdmin();
    }

    @Override
    public boolean Login(int admin_id, String password) {
        Admin admin = findAdminById(admin_id);
        if (admin != null) {
            if (admin.getPassword().equals(password)) {
                return true;
            } else {
                return false;
            }
        }else{
            return false;
        }
    }

    @Override
    public Admin findAdminById(int admin_id) {
        return admin_loginMapper.findById(admin_id);
    }
}

